package com.microservice.salmon.db.enums;

import lombok.Getter;

/**
 * <p>
 * 支付来源 1:支付宝，2：微信
 * </p>
 *
 * @author 王洪庆 2019-03-07 13:36
 */
@Getter
public enum PaymentFromEnum {

    ALIPAY("1", "支付宝"),
    WEIXIN("2", "微信");

    private Byte code;
    private String message;
    PaymentFromEnum(String code, String message) {
        this.code = Byte.valueOf(code);
        this.message = message;
    }

    public static PaymentFromEnum codeOf(Byte code){
        for(PaymentFromEnum v : values()){
            if(v.getCode().equals(code)){
                return v;
            }
        }
        throw new RuntimeException("没有找到对应的枚举");
    }
}
